$(function(){
	if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|SymbianOS)/i))) {
		window.location.replace("mlogin.html");
	}
    $('#login_btn').bind('click', function(){
    	if($("#pnumber").val() == ''){
    		$.messager.alert('','请填写手机号！','error');
    		$("#pnumber").focus();
		}else if($('#rand').val() == ''){
			$.messager.alert('','请填写验证码！','error');
    		$('#rand').focus();
		}else{
			$.post("/dologin",
					{	phone:$("#pnumber").val(),
						password:$("#rand").val(),
					},
					function(data){
                        var json = eval('(' + data + ')');
                        if(json.status=='Success') {
                            $.cookie('JSESSIONID',json.token,{ expires: 7, path: '/' });
                            $.cookie('PHONE',$("#pnumber").val(),{ expires: 7, path: '/' });
                            $.cookie('NAME',json.name,{ expires: 7, path: '/' });
                            $.cookie('ISADMIN',json.isadmin,{ expires: 7, path: '/' });
                            $.cookie('ISASSISTANT',json.isassistant,{ expires: 7, path: '/' });
                            $.messager.progress({
                                title:'登录成功！',
                                msg:'页面正在跳转...'
                            });
                            setTimeout(function(){
                                $.messager.progress('close');
                                window.location.href="main.html";
                            },1500);m7m
                        }else $.messager.alert('','登录失败','error');
	        });
		}
    });
});
